arr=[1,2,3,4]
count=0
for i in range(len(arr)):
    a=str(arr.pop(i))
    for j in range(len(arr)):
        b=str(arr.pop(j))
        for k in range(len(arr)):
            c=str(arr[k])
            print(a+b+c,end=' ')
            count+=1
        arr.insert(j,int(b))
    arr.insert(i,int(a))
    print(' ')
print('能组成{}个互不相同且无重复数字的三位数'.format(count))
